package com.tonann.app.mapper;

import com.tonann.app.domain.AppSensorRecord;
import com.tonann.app.domain.AppSensorRecordDay;
import com.tonann.app.domain.AppSensorRecordHour;
import com.tonann.app.domain.AppSensorRecordMonth;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 运行记录Mapper接口
 *
 * @author tonann
 * @date 2022-10-21
 */
@Mapper
public interface AppSensorRecordMonthMapper  extends BaseMapper<AppSensorRecordMonth> {
    /**
     * 查询运行记录
     *
     * @param recordId 运行记录主键
     * @return 运行记录
     */
    public AppSensorRecordMonth selectAppSensorRecordMonthByRecordId(Long recordId);

    /**
     * 查询运行记录列表
     *
     * @param appSensorRecord 运行记录
     * @return 运行记录集合
     */
    public List<AppSensorRecordMonth> selectAppSensorRecordMonthList(AppSensorRecordMonth appSensorRecord);

    /**
     * 新增运行记录
     *
     * @param appSensorRecord 运行记录
     * @return 结果
     */
    public int insertAppSensorRecordMonth(AppSensorRecordMonth appSensorRecord);

    @Override
    public int insertBatch(List<AppSensorRecordMonth> list);
    /**
     * 修改运行记录
     *
     * @param appSensorRecord 运行记录
     * @return 结果
     */
    public int updateAppSensorRecordMonth(AppSensorRecordMonth appSensorRecord);

    /**
     * 删除运行记录
     *
     * @param recordId 运行记录主键
     * @return 结果
     */
    public int deleteAppSensorRecordMonthByRecordId(Long recordId);

    /**
     * 批量删除运行记录
     *
     * @param recordIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAppSensorRecordMonthByRecordIds(Long[] recordIds);

    List<AppSensorRecordMonth> selectAppSensorRecordMonthListByInterval(@Param("sensorId") Long sensorId, @Param("interval") Integer interval);

    List<AppSensorRecordMonth> selectAppSensorRecordMonthListBySensorIdsAndInterval(@Param("sensorIds")List<Long> sensorIds, @Param("interval") Integer interval);

    AppSensorRecordMonth selectPreNoZeroAppSensorRecordByRecordId(@Param("recordId") Long recordId, @Param("sensorId") Long sensorId);

    AppSensorRecordMonth selectPreNoZeroAppSensorRecordByTime(@Param("createTime") LocalDate createTime, @Param("sensorId") Long sensorId);

    List<AppSensorRecordMonth> selectList(List<Long> list);
}
